<template>
<XtxBread>
   <XtxBreadItem to="/">首页</XtxBreadItem>
   <XtxBreadItem :to="`/category/${subObj.parentId}`">{{subObj.parentName}}</XtxBreadItem>
   <XtxBreadItem>{{subObj.name}}</XtxBreadItem>
</XtxBread>
</template>
<script>
import { findSubCategoryFilter } from '@/api/category'
import { useRoute } from 'vue-router'
import { onMounted, ref } from 'vue'
export default {
  name: 'SubBread',
  setup () {
    const route = useRoute()
    const subObj = ref({})
    async function getsubObj () {
    //   const subId = route.params.id
      const res = await findSubCategoryFilter(route.params.id)
      console.log('二级分类数据', res)
      //   在品牌和规则的头部添加一个全部类别
      subObj.value = res.data.result
    }
    onMounted(() => {
      getsubObj()
    })
    return { subObj }
  }
}
</script>
